
// src/MonthlyStatistics.java
import java.util.List;

public class MonthlyStatistics {
    public void displayStatistics(List<Income> incomes, List<Expense> expenses) {
        double totalIncome = incomes.stream().mapToDouble(Income::getAmount).sum();
        double totalExpense = expenses.stream().mapToDouble(Expense::getAmount).sum();
        System.out.println("月收入: " + totalIncome);
        System.out.println("月支出: " + totalExpense);
        System.out.println("结余: " + (totalIncome - totalExpense));
    }
}
